#ifndef _CLIENTWORKER_H_
#define _CLIENTWORKER_H_

#include <string>

namespace rise
{
  namespace sockets
  {
    class CRecvSocket;
  }
}

namespace smq
{
  class MessageQueueManager;

  //! client worker
  class ClientWorker
  {
  public:
    ClientWorker();
    ~ClientWorker();

    //! get client worker socket
    /*! \return socket
      */
    rise::sockets::CRecvSocket& GetSocket();

    //! start client worker (start associated thread)
    void Start();

    //! stop client worker (stop associated thread)
    void Stop();

    //! is client worker in finished (stopping is done) state
    /*! \return true, if client worker is in finished state
      */
    bool IsFinished() const;

    //! wait client worker thread for ends
    void Join();

    //! get client name
    /*! \return client name
      */
    const std::string& GetName() const;

    //! get client type
    /*! \return client type: "publisher" or "subscriber"
      */
    const std::string& GetType() const;

  private:
    ClientWorker(const ClientWorker&);
    ClientWorker& operator=(const ClientWorker&);
    struct ClientWorkerImpl;
    ClientWorkerImpl* m_pImpl;
  };
}

#endif // _CLIENTWORKER_H_
